#!/bin/bash
# Date  : 2021-01-15 20:07:09
# Author: scg
# Email : uzz_scg@163.com
# Func  : 批量登陆Linux主机并执行命令
username="root"
password="bit123"
port="22"
timeout=3
#所有集群的Masters安装nfs-kernel-server
#mkdir /root/deploy && sshpass -p "bit123" scp root@172.28.2.140:/root/deploy1/* /root/deploy &&
# && kubectl apply -f storageClass-nfs.yaml && kubectl apply -f rabc-deploy.yaml && kubectl apply -f resource-allocator.yaml


login(){
    echo ""
    echo "-------------------------------------------------------- "
    echo "cd /root/deploy && /opt/kube/bin/kubectl apply -f storageClass-nfs.yaml &&
          /opt/kube/bin/kubectl apply -f rabc-deploy.yaml &&
          /opt/kube/bin/kubectl apply -f resource-allocator.yaml &&
          /opt/kube/bin/kubectl apply -f statusTracker.yaml &&
          /opt/kube/bin/kubectl apply -f pushgateway-conf.yml &&
          rm rabc-deploy.yaml_bak resource-allocator.yaml_bak storageClass-nfs.yaml_bak'"
    echo "--------------------------------------------------------"
    echo ""
  pssh -l root -h ipMaster.txt ' cd /root/deploy && 
  /opt/kube/bin/kubectl apply -f storageClass-nfs.yaml &&
  /opt/kube/bin/kubectl apply -f rabc-deploy.yaml &&
  /opt/kube/bin/kubectl apply -f resource-allocator.yaml &&
  /opt/kube/bin/kubectl apply -f statusTracker.yaml &&
  /opt/kube/bin/kubectl apply -f pushgateway-conf.yml &&
  rm rabc-deploy.yaml_bak resource-allocator.yaml_bak storageClass-nfs.yaml_bak'
}

login
ls
